﻿
@model ChronicleIM

@using (Ajax.BeginForm("Edit", "Chronicle",
                            new AjaxOptions()
                            {
                                HttpMethod = "POST",
                                OnBegin = "onBegin",
                                OnComplete = "onComplete",
                                OnSuccess = "updateSuccess",
                                //OnFailure = "handleError",
                                //UpdateTargetId = "tr" + Model.Id

                            }, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.Id)
   

    <!-- 添加菜单 Modal -->
    <div class="modal fade" id="ModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">@string.Format("编辑{0}", EntityNames.Chronicle)</h4>
                </div>
                <div class="modal-body">


                    <div class="form-group">
                        @Html.LabelFor(model => model.Title, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextAreaFor(model => model.Title, new { @class = "form-control", placeholder = Labels.Title })
                            @Html.ValidationMessageFor(model => model.Title)
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">@(Labels.Year + Labels.Month + Labels.Day)</label>
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.Year, (SelectList)ViewBag.Years, $"--{Labels.Year}--", new { @class = "form-control", style = "width:120px;display:inline-block;" })
                            @Html.DropDownListFor(model => model.Month, (SelectList)ViewBag.Months, $"--{Labels.Month}--", new { @class = "form-control", style = "width:120px;display:inline-block;" })
                            @Html.DropDownListFor(model => model.Day, (SelectList)ViewBag.Days, $"--{Labels.Day}--", new { @class = "form-control", style = "width:120px;display:inline-block;" })

                            @Html.ValidationMessageFor(model => model.Year)
                            @Html.ValidationMessageFor(model => model.Month)
                            @Html.ValidationMessageFor(model => model.Day)
                        </div>
                    </div>


                    <div class="form-group">
                        <div class="col-md-5 col-md-offset-2">
                            <div class="checkbox">
                                <label>
                                    @Html.CheckBoxFor(model => model.Active)  @Html.DisplayNameFor(model => model.Active)
                                </label>
                            </div>
                        </div>
                        <div class="col-md-5">
                            @Html.ValidationMessageFor(model => model.Active)
                        </div>
                    </div>




                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>保存</button>
                </div>
            </div>
        </div>
    </div>
}

<script type="text/javascript" language=javascript>
    $.validator.unobtrusive.parse(document);


</script>